/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Lab6_test;

import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author c0909h1169
 */
public class ThreadTwo implements Runnable {

    Thread t;
    Data d;

    public ThreadTwo(Data d) {
        this.d = d;
        t = new Thread(this);
        t.start();
    }

    public void run() {
        //throw new UnsupportedOperationException("Not supported yet.");
        
            synchronized (d) {
                if (d.flag) {
                    d.displayArr();
                    d.flag = false;
                    d.notify();
                }
                try {
                    d.wait();
                } catch (InterruptedException ex) {
                    //Logger.getLogger(ThreadTwo.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        
    }
}
